﻿//======================================================================
//
//        Copyright (C) 2008 HOHO``
//        All rights reserved
//
//        filename :$safeitemrootname$
//        description :登陆控件。未被任何引用。
//
//        created by 裘中杰 at  $time$
//======================================================================


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Hisun.Controllers;

namespace Hisun.UserControl
{
    public partial class Login : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lnkBtnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(username.Text) || string.IsNullOrEmpty(password.Text))
                return;
            try
            {
                AbcLogin login = new AbcLogin(username.Text);
                if (login.CheckPassword(password.Text) != 0)
                {
                    Response.Write("密码错误!");
                    Response.End();
                }
                if (login.isAccountLock)
                {
                    Response.Write("账户被停用");
                    Response.End();
                }
                login.Enter();
                if (Request.QueryString["redir"] == null)
                    Response.Redirect("~/Default.aspx");
                else
                    Response.Redirect(Request.QueryString["redir"].ToString());
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                Response.End();
            }
        }
    }
}